package com.example.demo.config;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 登录拦截校验的保底类
 */
@ControllerAdvice //这个是为了拦截器的
public class AppConfig implements WebMvcConfigurer {

    /**
     * 注册拦截
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns("/css/**")
                .excludePathPatterns("/editor.md/**")
                .excludePathPatterns("/img/**")
                .excludePathPatterns("/js/**")
                .excludePathPatterns("/user/login")
                .excludePathPatterns("/user/reg")
                .excludePathPatterns("/user/show-aut")
                .excludePathPatterns("/user/login-logout")
                .excludePathPatterns("/art/incr-rcount")
                .excludePathPatterns("/art/detail")
                .excludePathPatterns("/art/listbypage")
                .excludePathPatterns("/art/allcount")
                .excludePathPatterns("/comment/show")
                .excludePathPatterns("/comment/del")
                .excludePathPatterns("/comment/add")
                .excludePathPatterns("/likes/count")
                .excludePathPatterns("/user/check-security")
                .excludePathPatterns("/user/get-checkpassword")
                .excludePathPatterns("/follow/select")
                .excludePathPatterns("/upload/**")
                .excludePathPatterns("/login.html")
                .excludePathPatterns("/reg.html")
                .excludePathPatterns("/blog_list.html")
                .excludePathPatterns("/fund_password.html")
                .excludePathPatterns("/blog_content.html");


    }

}
